import React, { PureComponent } from 'react';
import { connect } from 'dva';
import { Form } from '@ant-design/compatible';
import '@ant-design/compatible/assets/index.css';
import { Row, Col, Card, Select, Input, Anchor, AutoComplete, message } from 'antd';
import queryString from 'query-string';
import router from 'umi/router';
import styles from '@/utils/utils.less';
import PageHeaderWrapper from '@/components/PageHeaderWrapper';
import Authorized from '@/utils/Authorized';

import SupplierBasicInfor from './SupplierBasicInfor'; // 供应商基本信息
import ScopeOfBusiness from './ScopeOfBusiness'; // 业务范围
import SupplierProtocol from './SupplierProtocol'; // 供应商协议
import OnceCharge from './OnceCharge'; // 一次性收费
import ChargeBill from './ChargeBill'; // 收费账单
import OncePay from './OncePay'; // 一次性付费
import CustomerBill from './CustomerBill'; // 付费账单

import BasicInfor from './BasicInfor'; // 员工基本信息
import AddEmploeTask from './AddEmploeTask'; // 增员任务
import ReduceEmploeTask from './ReduceEmploeTask'; // 减员任务
import AdjustTask from './AdjustTask'; // 调整任务
import PaymentInfor from './PaymentInfor'; // 社保缴纳查询
import SocialHandleInfor from './SocialHandleInfor'; // 社保服务办理
import RefundInfor from './RefundInfor'; // 返款信息
import Payroll from './Payroll'; // 代发工资
import ProvidentFundService from './ProvidentFundService'; // 公积金服务办理
// import LaborContractInfor from './LaborContractInfor'; // 劳动合同

const { Search } = Input;
const { Option } = Select;
const FormItem = Form.Item;
const { Link } = Anchor;
@connect(({ integratedqueryns, menu, loading }) => ({
  menu,
  loading: loading.models.integratedqueryns,
  empBaseInfo: integratedqueryns.empBaseInfo, // 员工基本信息
  addTaskList: integratedqueryns.addTaskList, // 增员任务列表数据
  reduceTaskList: integratedqueryns.reduceTaskList, // 减员任务列表数据
  adjustTaskList: integratedqueryns.adjustTaskList, // 调整任务列表数据
  empInsPayList: integratedqueryns.empInsPayList, // 社保实缴列表数据
  empAccuPayList: integratedqueryns.empAccuPayList, // 公积金实缴列表数据
  wageDataList: integratedqueryns.wageDataList, // 代发工资列表数据
  custBaseInfo: integratedqueryns.custBaseInfo, // 客户基本信息
  custConstList: integratedqueryns.custConstList, // 商务合同列表数据
  crmquoDataList: integratedqueryns.crmquoDataList, // 报价单列表数据
  onceChargeDataList: integratedqueryns.onceChargeDataList, // 一次性收费列表数据
  billList: integratedqueryns.billList, // 客户账单列表数据
  supplyList: integratedqueryns.supplyList, //
  supplyBaseInfo: integratedqueryns.supplyList, // 供应商基本信息
  type: integratedqueryns.type, // 区分客户，雇员
  empLabelObj: integratedqueryns.empLabelObj, // 搜索雇员默认值
  empShowName: integratedqueryns.empShowName, // 雇员显示的默认值
  suppLabelObj: integratedqueryns.suppLabelObj,
}))
@Form.create()
class SearchList extends PureComponent {
  constructor(props) {
    super(props);
    this.state = {
      empList: [], // 搜索雇员列表数据
      custList: [], // 搜索客户列表数据
      empName: null,
      certNo: null,
      suppId: null,
      name: null,
    };
  }

  componentDidMount() {
    const { dispatch, location, empLabelObj, suppLabelObj, type } = this.props;
    dispatch({
      type: 'integratedqueryns/fetchSupplyList',
      payload: { name: null },
    });
    const { isMenuLink } = queryString.parse(location.search);
    if (isMenuLink === 'true') {
      this.resetAndGeLlist(location);
    } else if (type === 1) {
      // 供应商
      if (suppLabelObj) {
        this.setState({ suppId: suppLabelObj.key, name: suppLabelObj.label });
      }
    } else if (empLabelObj) {
      // 雇员
      const empKeyObj = empLabelObj.key;
      const empKeyArr = empKeyObj.split(' ');
      const empLabelObjs = empLabelObj.label;
      const empLabelArr = empLabelObjs.split(' ');
      this.setState({ empName: empLabelArr[0], certNo: empKeyArr[1] });
    }
  }

  // 清除所有的历史记录数据
  delAllListData = () => {
    const { dispatch } = this.props;
    dispatch({
      type: 'integratedqueryns/updateModalData',
      payload: {
        type: 1,
        empBaseInfo: {}, // 员工基本信息
        addTaskList: {
          list: [],
        },
        reduceTaskList: {
          list: [],
          pagination: {
            current: 1,
            pageSize: 10,
            total: 10,
          },
        },
        adjustTaskList: {
          list: [],
          pagination: {
            current: 1,
            pageSize: 10,
            total: 10,
          },
        },
        empInsPayList: {
          list: [],
        },
        empAccuPayList: {
          list: [],
        },
        empInsSerInfoList: {
          list: [],
        },
        empInsRefundInfoList: {
          list: [],
        },
        wageDataList: {
          list: [],
        },
        empLaborContInfoList: {}, // 劳动合同信息数据
        supplyBaseInfo: {}, // 供应商基本信息
        custConstList: {
          list: [],
        },
        crmquoDataList: {
          list: [],
        },
        onceChargeDataList: {
          list: [],
        },
        billList: {
          list: [],
          pagination: {
            current: 1,
            pageSize: 10,
            total: 10,
          },
        },
        // 供应商协议列表
        supplierList: {
          list: [],
          pagination: {
            current: 1,
            pageSize: 10,
            total: 10,
          },
        },
        supplyList: [],
        SuppBusiData: [],
        suppId: null,
        chargeBillListData: {
          list: [],
          pagination: {
            current: 1,
            pageSize: 10,
            total: 10,
          },
        },
        oncePayListData: {
          list: [],
          pagination: {
            current: 1,
            pageSize: 10,
            total: 10,
          },
        },
        paymentBillListData: {
          list: [],
          pagination: {
            current: 1,
            pageSize: 10,
            total: 10,
          },
        },
        empLabelObj: undefined,
        suppLabelObj: undefined,
      },
    });
  };

  // 选择客户，雇员
  getChangeEmpName = value => {
    const { dispatch, form } = this.props;
    dispatch({
      type: 'integratedqueryns/updateModalData',
      payload: {
        type: value,
      },
    });
    form.resetFields();
  };

  // // 客户搜索
  // getCustList = value => {
  //   const { dispatch } = this.props;
  //   this.setState({ empName: value });
  //   dispatch({
  //     type: 'integratedqueryns/getCustList',
  //     payload: {
  //       name: value,
  //     },
  //     callback: response => {
  //       if (response.success && response.data) {
  //         this.setState({ custList: response.data });
  //       } else {
  //         message.warning(response.message || '获取客户列表失败：服务器端错误');
  //       }
  //     },
  //   });
  // };

  // 选择某一供应商
  selectCust = suppObj => {
    const { dispatch } = this.props;
    this.setState({ suppId: suppObj.key, name: suppObj.label });
    dispatch({
      type: 'integratedqueryns/updateModalData',
      payload: {
        suppLabelObj: suppObj,
      },
    });
    // 供应商基本信息
    dispatch({
      type: 'integratedqueryns/getSupplyBaseInfo',
      payload: {
        suppId: suppObj.key,
      },
    });
    // 业务范围
    dispatch({
      type: 'integratedqueryns/getSuppBusiData',
      payload: {
        suppId: suppObj.key,
        name: suppObj.label,
      },
    });
    // 供应商协议
    dispatch({
      type: 'integratedqueryns/getSupplierList',
      payload: {
        pagerArg: { currentPage: 1, pageSize: 5 },
        recvSuppId: suppObj.key,
      },
    });
    // 一次性收费
    dispatch({
      type: 'integratedqueryns/getOnceChargeList',
      payload: {
        // ordSndrId: suppObj[0],
        ordSndrId: suppObj.key,
        pageArg: { currentPage: 1, pageSize: 2 },
      },
    });

    // 收费账单
    dispatch({
      type: 'integratedqueryns/getChargebillList',
      payload: {
        sendSuppId: suppObj.key,
        pageArg: { currentPage: 1, pageSize: 2 },
      },
    });
    // 一次性付费
    dispatch({
      type: 'integratedqueryns/getOncePayList',
      payload: {
        ordRecvId: suppObj.key,
        pageArg: { currentPage: 1, pageSize: 2 },
      },
    });
    // 付费账单
    dispatch({
      type: 'integratedqueryns/getPaymentBillList',
      payload: {
        recvSuppId: suppObj.key,
        pageArg: { currentPage: 1, pageSize: 2 },
      },
    });
  };

  // 清空雇员上一次搜索的历史记录
  emptyHistoryEmp = () => {
    this.setState({ empList: [] });
  };

  // 雇员搜索
  getEmpList = value => {
    // 判断字符串中包含空格，特殊字符
    const reg = /^[\u4e00-\u9fa5_a-zA-Z0-9]+$/;
    let newValue = '';
    if (!reg.test(value)) {
      newValue = value.substring(value.indexOf('(') + 1, value.indexOf(')'));
    }
    const { dispatch } = this.props;
    this.setState({ empName: value });
    dispatch({
      type: 'integratedqueryns/getEmpList',
      payload: {
        // eslint-disable-next-line no-unneeded-ternary
        empParam: newValue ? newValue : value,
      },
      callback: response => {
        if (response.success && response.data) {
          this.setState({ empList: response.data });
          if (response.data.length === 0) {
            message.warning('没有查询到该雇员下的信息！');
          }
        } else {
          message.warning(response.message || '获取雇员列表失败：服务器端错误');
        }
      },
    });
  };

  // 选择某一雇员
  selectEmp = (value, options) => {
    const {
      key,
      fsOptions: { cardNo, empId, empName },
    } = options;
    this.setState({ empName, certNo: cardNo });
    const { dispatch } = this.props;
    dispatch({
      type: 'integratedqueryns/updateModalData',
      payload: {
        empLabelObj: { key, label: `${empId} ${cardNo}` },
        empShowName: value,
      },
    });
    // 员工基本信息
    dispatch({
      type: 'integratedqueryns/getBaseInfo',
      payload: {
        empId, // 雇员id
      },
    });

    // 增员任务
    dispatch({
      type: 'integratedqueryns/getAddTaskList',
      payload: {
        pageArg: { currentPage: 1, pageSize: 10 },
        empId,
      },
    });
    // 减员任务
    dispatch({
      type: 'integratedqueryns/getReduceTaskList',
      payload: {
        pageArg: { currentPage: 1, pageSize: 10 },
        empId,
      },
    });
    // 调整任务
    dispatch({
      type: 'integratedqueryns/getAdjustTaskList',
      payload: {
        pageArg: { currentPage: 1, pageSize: 10 },
        empId,
      },
    });
    // 社保实缴查询
    dispatch({
      type: 'integratedqueryns/getEmpInsPayInfo',
      payload: {
        // pageArg: { currentPage: 1, pageSize: 10 },
        certNo: cardNo, // 雇员身份证号
      },
    });
    // 公积金实缴查询
    dispatch({
      type: 'integratedqueryns/getEmpAccuPayInfo',
      payload: {
        // pageArg: { currentPage: 1, pageSize: 10 },
        certNo: cardNo,
      },
    });
    // 代发工资
    dispatch({
      type: 'integratedqueryns/getWageInfoList',
      payload: {
        pageArg: { currentPage: 1, pageSize: 2 },
        empId: cardNo,
      },
    });

    // 社保服务办理
    dispatch({
      type: 'integratedqueryns/getEmpInsSerInfo',
      payload: {
        // pageArg: { currentPage: 1, pageSize: 2 },
        certNo: cardNo, // 雇员身份证号
      },
    });

    // 返款信息
    dispatch({
      type: 'integratedqueryns/getEmpInsRefundInfo',
      payload: {
        // pageArg: { currentPage: 1, pageSize: 2 },
        certNo: cardNo, // 雇员身份证号
      },
    });
  };

  // 跳转
  jumpRouting = (targetRouter, id, type, sendOrReceive = 1) => {
    let dynamicRouter;
    switch (targetRouter) {
      case 'contId':
        dynamicRouter = '/salemanage/busicont'; // 客户商务合同
        break;
      case 'quoId':
        dynamicRouter = '/salemanage/supplierprotocol'; // 客户报价单
        break;
      case 'suppProtId':
        dynamicRouter = '/supplymanage/protocol'; // 供应商协议
        break;
      case 'onceFeeChrgId':
        dynamicRouter = '/chargmanage/oncechargens'; // 一次性收费
        break;

      case 'billId':
        dynamicRouter = '/chargmanage/chargebillns'; // 收费账单
        break;
      case 'billIds':
        dynamicRouter = '/paymanage/paybill'; // 付费账单
        break;
      case 'onceFeePayId':
        dynamicRouter = '/paymanage/oncepayns'; // 一次性付费
        break;
      case 'suppId':
        dynamicRouter = '/supplymanage/look'; // 业务范围
        break;
      case 'sendOrdAddTaskId':
        dynamicRouter = '/sendordermanage/addemployee'; // 发单增员任务
        break;
      case 'recvOrdAddTaskId':
        dynamicRouter = '/receiveordermanage/addemployee'; // 接单增员任务
        break;

      case 'sendOrdCutTaskId':
        dynamicRouter = '/sendordermanage/reduceemployee'; // 发单减员任务
        break;
      case 'recvOrdCutTaskId':
        dynamicRouter = '/receiveordermanage/reduceemployee'; // 接单减员任务
        break;

      case 'sendOrdAdjTaskId':
        dynamicRouter = '/sendordermanage/adjusttask'; // 发单调整任务
        break;
      case 'recvOrdAdjTaskId':
        dynamicRouter = '/receiveordermanage/adjusttask'; // 接单调整任务
        break;

      case 'deduTaskId':
        dynamicRouter = '/customservicemanage/reduceemployee'; // 员工减员任务
        break;
      case 'socialPay':
        dynamicRouter =
          sendOrReceive === 1
            ? '/socaccmanagereceive/socsearrchreceive'
            : '/socaccmanagesend/socsearrchsend'; // 员工社保实缴查询
        break;
      case 'accuPay':
        dynamicRouter =
          sendOrReceive === 1
            ? '/socaccmanagereceive/accusearrchreceive'
            : '/socaccmanagesend/accusearrchsend'; // 员工公积金实缴查询
        break;
      case 'insSerHdlId':
        dynamicRouter = '/socaccmanage/sochandle'; // 员工社保服务办理
        break;
      case 'refundInfoId':
        dynamicRouter = '/socaccmanagesend/rebatesend'; // 员工返款信息
        break;
      case 'wagePayInfoId':
        dynamicRouter = '/salarymanage/salarysend'; // 代发工资
        break;

      case 'wagePayProbId':
        dynamicRouter = '/salarymanage/salarysend'; // 代发工资  -  问题人员
        break;

      case 'laborContId':
        dynamicRouter = '/customservicemanage/laborcontract'; // 员工劳动合同管理
        break;
      default:
    }
    const { empName, certNo, name, suppId } = this.state;
    let routerParams = {};
    if (targetRouter === 'billIds') {
      routerParams = {
        pathname: id ? `${dynamicRouter}/detail` : `${dynamicRouter}/index`,
        query: {
          billId: id,
          isMenuLink: false,
        },
        queryParam: { suppId },
      };
    } else if (targetRouter === 'wagePayInfoId') {
      routerParams = {
        pathname: id ? `${dynamicRouter}/detail` : `${dynamicRouter}/index`,
        query: {
          [targetRouter]: id,
          isMenuLink: false,
        },
        queryParam: { empName, certNo, name, suppId },
      };
    } else if (targetRouter === 'refundInfoId') {
      // 返款信息
      if (type) {
        routerParams = {
          pathname: id ? `${dynamicRouter}/detail` : `${dynamicRouter}/index`,
          query: {
            [targetRouter]: id,
            isMenuLink: false,
            type,
          },
          queryParam: { empName, certNo, name, suppId },
        };
      } else {
        routerParams = {
          pathname: id ? `${dynamicRouter}/detail` : `${dynamicRouter}/index`,
          query: {
            [targetRouter]: id,
            isMenuLink: false,
            type,
          },
          queryParam: { empName, certNo, name, suppId },
        };
      }
    } else if (targetRouter === 'suppId') {
      // 返款信息
      if (type) {
        routerParams = {
          pathname: id ? `${dynamicRouter}/detail` : `${dynamicRouter}/index`,
          query: {
            [targetRouter]: id,
            isMenuLink: false,
            name: type,
          },
          queryParam: { empName, certNo, name, suppId },
        };
      } else {
        routerParams = {
          pathname: id ? `${dynamicRouter}/detail` : `${dynamicRouter}/index`,
          query: {
            [targetRouter]: id,
            isMenuLink: false,
            name: type,
          },
          queryParam: { empName, certNo, name, suppId },
        };
      }
    } else if (targetRouter === 'sendOrdAdjTaskId' || targetRouter === 'recvOrdAdjTaskId') {
      // 接单调整，发单调整
      routerParams = {
        pathname: id ? `${dynamicRouter}/detail` : `${dynamicRouter}/index`,
        query: {
          [targetRouter]: id,
          isMenuLink: false,
          adjType: type,
        },
        queryParam: { empName, certNo, name, suppId },
      };
    } else {
      routerParams = {
        pathname: id ? `${dynamicRouter}/detail` : `${dynamicRouter}/index`,
        query: {
          [targetRouter]: id,
          isMenuLink: false,
        },
        queryParam: { empName, certNo, name, suppId },
      };
    }
    router.push(routerParams);
  };

  // 重置查询条件并获取列表
  async resetAndGeLlist(location) {
    const { dispatch, form } = this.props;
    dispatch({
      type: 'global/changeIsMenuLink',
      payload: location,
    });
    await this.delAllListData();
    form.resetFields();
  }

  render() {
    const { empList, custList } = this.state;
    const { supplyList, type, empShowName, suppLabelObj, form } = this.props;
    const { getFieldDecorator } = form;
    // 雇员列表查询
    let options = null;
    if (empList && empList.length) {
      options = empList.map(opt => (
        <Option
          key={`${opt.empId} ${opt.cardNo}`}
          value={`${opt.empName} (${opt.cardNo})`}
          fsOptions={opt}
        >
          {`${opt.empName} (${opt.cardNo})`}
        </Option>
      ));
    }
    // 客户列表查询
    // eslint-disable-next-line no-unused-vars
    let custoptions = null;
    if (custList && custList.length) {
      custoptions = custList.map(opt => (
        <Option key={opt.suppId} value={opt.suppId}>
          {opt.name}
        </Option>
      ));
    }
    return (
      <PageHeaderWrapper>
        <Card className={styles.searchCard} style={{ marginBottom: 0 }}>
          <div>
            <Row>
              <Col span={12} offset={6}>
                <div className={styles.searchManageBox}>
                  <Select
                    value={type}
                    style={{
                      marginRight: -2,
                      fontSize: 14,
                      float: 'left',
                      width: '90px',
                      marginTop: type === 1 ? 0 : 1,
                    }}
                    size="large"
                    onSelect={value => this.getChangeEmpName(value)}
                  >
                    <Option value={1}>供应商</Option>
                    <Option value={2}>雇员</Option>
                  </Select>
                </div>
                {type === 1 ? (
                  <div className={styles.searchManageSelect}>
                    <FormItem style={{ width: '75%', float: 'left' }}>
                      {getFieldDecorator('suppForm', {
                        initialValue: suppLabelObj,
                      })(
                        <Select
                          placeholder="请输入关键字检索"
                          showSearch
                          optionFilterProp="children"
                          size="large"
                          labelInValue
                          notFoundContent="暂无数据"
                          onSelect={this.selectCust}
                          style={{ width: '100%' }}
                        >
                          {supplyList.map(item => (
                            <Option key={item.suppId}>{item.name}</Option>
                          ))}
                        </Select>
                      )}
                    </FormItem>
                  </div>
                ) : (
                  <div className={styles.searchManageBox}>
                    <FormItem style={{ width: '75%', float: 'left' }}>
                      {getFieldDecorator('empForm', {
                        initialValue: empShowName,
                      })(
                        <AutoComplete
                          size="large"
                          // labelInValue
                          style={{ width: '100%' }}
                          dataSource={options}
                          onSelect={this.selectEmp}
                          onChange={this.emptyHistoryEmp}
                        >
                          <Search
                            placeholder="请输入"
                            enterButton="搜索"
                            size="large"
                            style={{ width: '100%' }}
                            onSearch={value => this.getEmpList(value)}
                          />
                        </AutoComplete>
                      )}
                    </FormItem>
                  </div>
                )}
              </Col>
            </Row>
          </div>
        </Card>
        {type === 1 ? (
          <div className={styles.antAnchorDefaultBg}>
            <Anchor
              onClick={e => e.preventDefault()}
              style={{ background: '#f0f2f5' }}
              targetOffset={50}
            >
              <Row type="flex" justify="space-around">
                <Col>
                  <Link href="#supplierbasicInfor" title="供应商基本信息" />
                </Col>
                <Authorized authority="ns:supp:busiscope" noMatch={null}>
                  <Col>
                    <Link href="#scopeofbusiness" title="业务范围" />
                  </Col>
                </Authorized>
                <Authorized authority="business:suppProto:pageList" noMatch={null}>
                  <Col>
                    <Link href="#supplierprotocol" title="供应商协议" />
                  </Col>
                </Authorized>
                <Authorized authority="ns:onceChrg:queryChrgPage" noMatch={null}>
                  <Col>
                    <Link href="#oncecharge" title="一次性收费" />
                  </Col>
                </Authorized>
                <Authorized authority="ns:nsBillChrg:getList" noMatch={null}>
                  <Col>
                    <Link href="#chargebill" title="收费账单" />
                  </Col>
                </Authorized>
                {/* <Col>
                  <Link href="#invoiceinformation" title="发票信息" />
                </Col>         */}
                <Authorized authority="ns:oncefeePay:queryPayPage" noMatch={null}>
                  <Col>
                    <Link href="#oncepay" title="一次性付费" />
                  </Col>
                </Authorized>
                <Authorized authority="ns:nsBillPay:getList" noMatch={null}>
                  <Col>
                    <Link href="#paymentill" title="付费账单" />
                  </Col>
                </Authorized>
              </Row>
            </Anchor>
          </div>
        ) : (
          <div className={styles.antAnchorDefaultBg}>
            <Anchor
              onClick={e => e.preventDefault()}
              style={{ background: '#f0f2f5' }}
              targetOffset={50}
            >
              <Row type="flex" justify="space-around">
                <Col>
                  <Link href="#basicinfor" title="员工基本信息" />
                </Col>
                <Authorized
                  authority={['ns:send:addemployee', 'ns:receive:addemployee']}
                  noMatch={null}
                >
                  <Col>
                    <Link href="#increasetask" title="增员任务" />
                  </Col>
                </Authorized>
                <Authorized
                  authority={['ns:send:reduceemployee', 'ns:receive:reduceemployee']}
                  noMatch={null}
                >
                  <Col>
                    <Link href="#attritiontask" title="减员任务" />
                  </Col>
                </Authorized>

                <Authorized
                  authority={['ns:send:changeemployee', 'ns:receive:changeemployee']}
                  noMatch={null}
                >
                  <Col>
                    <Link href="#adjusttask" title="调整任务" />
                  </Col>
                </Authorized>
                <Authorized authority="ns:recvSocacc:insQuery" noMatch={null}>
                  <Col>
                    <Link href="#socialsecuritypayment" title="社保实缴查询" />
                  </Col>
                </Authorized>
                <Authorized authority="ns:recvSocacc:accuQuery" noMatch={null}>
                  <Col>
                    <Link href="#providentfundpayment" title="公积金实缴查询" />
                  </Col>
                </Authorized>
                <Authorized
                  authority={['ns:sendSocacc:handle', 'ns:recvSocacc:handle']}
                  noMatch={null}
                >
                  <Col>
                    <Link href="#socialsecurityservice" title="社保服务办理" />
                  </Col>
                </Authorized>
                <Authorized
                  authority={['ns:sendSocacc:rebate', 'ns:recvSocacc:rebate']}
                  noMatch={null}
                >
                  <Col>
                    <Link href="#rebateinformation" title="返款信息" />
                  </Col>
                </Authorized>
                <Authorized authority="business:provident:handle" noMatch={null}>
                  <Col>
                    <Link href="#providentfundservice" title="公积金服务办理" />
                  </Col>
                </Authorized>
                <Authorized authority={['business:wage:pay', 'business:wage:offl']} noMatch={null}>
                  <Col>
                    <Link href="#payroll" title="代发工资" />
                  </Col>
                </Authorized>
              </Row>
            </Anchor>
          </div>
        )}
        {type === 1 ? (
          <div>
            <SupplierBasicInfor />
            <Authorized authority="ns:supp:busiscope" noMatch={null}>
              <ScopeOfBusiness jumpRouting={this.jumpRouting} />
            </Authorized>
            <Authorized authority="business:suppProto:pageList" noMatch={null}>
              <SupplierProtocol jumpRouting={this.jumpRouting} />
            </Authorized>
            <Authorized authority="ns:onceChrg:queryChrgPage" noMatch={null}>
              <OnceCharge jumpRouting={this.jumpRouting} />
            </Authorized>
            <Authorized authority="ns:nsBillChrg:getList" noMatch={null}>
              <ChargeBill jumpRouting={this.jumpRouting} />
            </Authorized>
            <Authorized authority="ns:oncefeePay:queryPayPage" noMatch={null}>
              <OncePay jumpRouting={this.jumpRouting} />
            </Authorized>
            <Authorized authority="ns:nsBillPay:getList" noMatch={null}>
              <CustomerBill jumpRouting={this.jumpRouting} />
            </Authorized>
          </div>
        ) : (
          <div>
            <BasicInfor />
            <Authorized
              authority={['ns:send:addemployee', 'ns:receive:addemployee']}
              noMatch={null}
            >
              <AddEmploeTask jumpRouting={this.jumpRouting} />
            </Authorized>
            <Authorized
              authority={['ns:send:reduceemployee', 'ns:receive:reduceemployee']}
              noMatch={null}
            >
              <ReduceEmploeTask jumpRouting={this.jumpRouting} />
            </Authorized>
            <Authorized
              authority={['ns:send:changeemployee', 'ns:receive:changeemployee']}
              noMatch={null}
            >
              <AdjustTask jumpRouting={this.jumpRouting} />
            </Authorized>
            <Authorized
              authority={['ns:recvSocacc:insQuery', 'ns:recvSocacc:accuQuery']}
              noMatch={null}
            >
              <PaymentInfor jumpRouting={this.jumpRouting} />
            </Authorized>
            <Authorized authority={['ns:sendSocacc:handle', 'ns:recvSocacc:handle']} noMatch={null}>
              <SocialHandleInfor jumpRouting={this.jumpRouting} />
            </Authorized>
            <Authorized authority={['ns:sendSocacc:rebate', 'ns:recvSocacc:rebate']} noMatch={null}>
              <RefundInfor jumpRouting={this.jumpRouting} />
            </Authorized>
            <Authorized authority="business:provident:handle" noMatch={null}>
              <ProvidentFundService jumpRouting={this.jumpRouting} />
            </Authorized>
            <Authorized authority={['business:wage:pay', 'business:wage:offl']} noMatch={null}>
              <Payroll jumpRouting={this.jumpRouting} />
            </Authorized>
          </div>
        )}
      </PageHeaderWrapper>
    );
  }
}

export default SearchList;
